extends RichTextLabel

@export var kill_time = 5
var time = 0
@export var A_text = ""
var tween: Tween
func _ready() -> void:
	text = A_text
	tween = get_tree().create_tween()
	tween.set_ease(Tween.EASE_OUT)
	tween.set_loops(1)
	tween.set_parallel()
	tween.tween_property(self, "modulate:a", 1, 0.2)
	
func _physics_process(delta: float) -> void:
	time += delta
	if time >= kill_time:
		tween = get_tree().create_tween()
		tween.set_ease(Tween.EASE_OUT)
		tween.set_loops(1)
		tween.set_parallel()
		tween.tween_property(self, "modulate:a", 0, 0.2)
		tween.tween_property(self, "scale", Vector2.ZERO, 0.2)
		tween.tween_property(self, "custom_minimum_size:y", 0, 0.2)
	if time >= kill_time + 0.5:
		tween.kill()
		queue_free()
